#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int t;
vector<int> v;
string s;
int main() {
    cin >> t;
    while(t--) {
        int n;
        v.clear();
        cin >> n;
        for(int k=1;k<=n;k++) {
            cin >> s;
            for(int i=0;i<s.length();i++) {
                if(s[i] == '#') {
                    v.push_back(i+1);
                    break;
                }
            }
        }
        for(int i=n-1;i>=0;i--) cout << v[i] << " ";
        cout << endl;
    }
    return 0;
}